<html>
<head><meta charset="utf-8"><title>Advice for &quot;Support extern opaque types&quot; · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html">Advice for &quot;Support extern opaque types&quot;</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="208987740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/208987740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#208987740">(Sep 03 2020 at 15:48)</a>:</h4>
<p>Hey, thanks for your support on the previous issue :)<br>
I picked up another issue, the task is to add TypeName::Extern.<br>
Yet, I have a hard time figuring out what information should be stored in TypeName generally.<br>
To start off, I just added Extern as an empty Variant (<a href="https://github.com/memoryleak47/chalk/commit/73549302f42bf468273f4f85204ea46a971c00d8">https://github.com/memoryleak47/chalk/commit/73549302f42bf468273f4f85204ea46a971c00d8</a>).</p>
<p>So, is there some documentation on what TypeName actually is? ^^'</p>



<a name="208990016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/208990016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#208990016">(Sep 03 2020 at 16:01)</a>:</h4>
<p>It's like <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.TyKind.html"><code>TyKind</code></a> in rustc, except that it doesn't store type information that chalk doesn't need for trait solving</p>



<a name="208990310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/208990310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#208990310">(Sep 03 2020 at 16:03)</a>:</h4>
<p>chalk just needs to know what kind of type it is, because arrays and slices might be handled differently for example, but there's no nested types inside in most cases</p>



<a name="208990786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/208990786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#208990786">(Sep 03 2020 at 16:06)</a>:</h4>
<p>See also <a href="https://rust-lang.github.io/chalk/book/clauses/type_equality.html?highlight=TypeName#placeholder-associated-types">this part in the chalk book</a></p>



<a name="208998177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/208998177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#208998177">(Sep 03 2020 at 16:57)</a>:</h4>
<p><span class="user-mention" data-user-id="335294">@memoryleak47</span> so, I probably should have been more clear in my comment on the issue, but we probably want to store a <code>DefId</code> in <code>Extern</code></p>



<a name="208998341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/208998341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#208998341">(Sep 03 2020 at 16:58)</a>:</h4>
<p>So, a new <code>ExternDefId</code> that wraps <code>Interner::InternedDefId</code></p>



<a name="208999819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/208999819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#208999819">(Sep 03 2020 at 17:09)</a>:</h4>
<p>Other than that, those changes look good</p>



<a name="208999898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/208999898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#208999898">(Sep 03 2020 at 17:10)</a>:</h4>
<p>Next step would be adding test support and some tests</p>



<a name="209002036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209002036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209002036">(Sep 03 2020 at 17:24)</a>:</h4>
<p>Alright, thanks (:</p>



<a name="209040501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209040501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209040501">(Sep 03 2020 at 23:22)</a>:</h4>
<p>So, I now added ExternDefId (<a href="https://github.com/memoryleak47/chalk/commit/17416bb023d06c4336f18f81c55b53003d07ec42">https://github.com/memoryleak47/chalk/commit/17416bb023d06c4336f18f81c55b53003d07ec42</a>).<br>
But its never constructed, should there maybe be a chalk_parse::ast::Extern, or something similar?<br>
Also, about the tests - where would I put the tests, and what should they actually test?</p>



<a name="209044756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209044756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209044756">(Sep 04 2020 at 00:34)</a>:</h4>
<p>Yeah, so probably add another item here: <a href="https://github.com/rust-lang/chalk/blob/46344c8074f2a8b9a377a1281021bf879ff5cc60/chalk-parse/src/ast.rs#L22">https://github.com/rust-lang/chalk/blob/46344c8074f2a8b9a377a1281021bf879ff5cc60/chalk-parse/src/ast.rs#L22</a></p>



<a name="209044791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209044791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209044791">(Sep 04 2020 at 00:35)</a>:</h4>
<p>Probably just <code>Extern(Identifier)</code></p>



<a name="209044858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209044858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209044858">(Sep 04 2020 at 00:36)</a>:</h4>
<p>Well, eh, might be easier to just have a newtype <code>ExternDefn</code></p>



<a name="209044934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209044934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209044934">(Sep 04 2020 at 00:38)</a>:</h4>
<p>Then add the relevant parse code in <code>parser.lalrpop</code></p>



<a name="209045135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209045135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209045135">(Sep 04 2020 at 00:42)</a>:</h4>
<p>For tests: check that they are <code>WellFormed</code>, are not <code>Sized</code>, don't impl <code>Copy</code>, and don't impl <code>Clone</code></p>



<a name="209050166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209050166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209050166">(Sep 04 2020 at 02:41)</a>:</h4>
<p>It seems we need to store the extern types in chalk_integration::program::Program anyhow.<br>
Any suggestions? Maybe as extern_ty_ids: BTreeMap&lt;Identifier, ExternDefId&lt;I&gt;&gt;</p>



<a name="209057266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209057266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209057266">(Sep 04 2020 at 05:53)</a>:</h4>
<p>That sounds probably right</p>



<a name="209069757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209069757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209069757">(Sep 04 2020 at 08:58)</a>:</h4>
<p>Alright, now I did parsing and lowering.<br>
But I still didn't construct TypeName::Extern (should that have happened in the lowering?)<br>
Also, I probably should add some method to RustIrDatabase so that the Solvers can actually work with the extern types, right?</p>



<a name="209115938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209115938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209115938">(Sep 04 2020 at 16:46)</a>:</h4>
<p>Indeed, should happen in lowering.</p>



<a name="209115941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209115941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209115941">(Sep 04 2020 at 16:46)</a>:</h4>
<p>And hmm.</p>



<a name="209116217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209116217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209116217">(Sep 04 2020 at 16:49)</a>:</h4>
<p>I don't think that we need to add anything to <code>RustIrDatabase</code>. We check impls with <code>impls_for_trait</code> which should include impls on extern types</p>



<a name="209116515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209116515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209116515">(Sep 04 2020 at 16:52)</a>:</h4>
<p>Also, side not looking at your PR, I don't think we will ever support <code>extern { type A; type B; }</code> in the test parser. It's not really "Rust" syntax. Its "close" to a heavily desugared Rust syntax.</p>



<a name="209116584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209116584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209116584">(Sep 04 2020 at 16:53)</a>:</h4>
<p>(Unless there is some functionality there that we need to reproduce that I don't know about)</p>



<a name="209116875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209116875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209116875">(Sep 04 2020 at 16:56)</a>:</h4>
<p>okay, I'll get rid of the FIXME then.</p>



<a name="209117168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209117168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209117168">(Sep 04 2020 at 16:58)</a>:</h4>
<p>So, I'm confused about the lowering now. We should obviously create TypeName::Extern at some point, but if the program stores the extern types as BTreeMap&lt;Identifier, ExternDefId&lt;I&gt;&gt;, then I don't see where this TypeName::Extern would exist in the program.</p>



<a name="209117852"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209117852" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209117852">(Sep 04 2020 at 17:03)</a>:</h4>
<p>Probably under <code>lookup_generic_arg</code></p>



<a name="209118245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118245">(Sep 04 2020 at 17:07)</a>:</h4>
<p>(sidenote, the parser/lowering code is kind of over-complicated I think)</p>



<a name="209118377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118377">(Sep 04 2020 at 17:08)</a>:</h4>
<p>You'll also probably need to update <code>TyWithoutId</code></p>



<a name="209118402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118402">(Sep 04 2020 at 17:08)</a>:</h4>
<p>(so you can actually use the extern types)</p>



<a name="209118409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118409">(Sep 04 2020 at 17:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22/near/209118245">said</a>:</p>
<blockquote>
<p>(sidenote, the parser/lowering code is kind of over-complicated I think)</p>
</blockquote>
<p>Hm... how could it be simplified?</p>



<a name="209118474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118474">(Sep 04 2020 at 17:09)</a>:</h4>
<p>Mmm, I'm not sure off the top of my head</p>



<a name="209118493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118493">(Sep 04 2020 at 17:09)</a>:</h4>
<p>It's not an area I'm super comfortable with</p>



<a name="209118530"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118530" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118530">(Sep 04 2020 at 17:09)</a>:</h4>
<p>Also, no you <em>don't</em> need to update <code>TyWithoutId</code></p>



<a name="209118546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118546">(Sep 04 2020 at 17:10)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22/near/209117852">said</a>:</p>
<blockquote>
<p>Probably under <code>lookup_generic_arg</code></p>
</blockquote>
<p>So, should I check whether the identifier matches some extern_ty, and then return that as an ApplicationTy?</p>



<a name="209118696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118696">(Sep 04 2020 at 17:11)</a>:</h4>
<p>Yes</p>



<a name="209118835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118835">(Sep 04 2020 at 17:12)</a>:</h4>
<p>It'll look somewhat similar to the opaque ty ids block</p>



<a name="209118896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118896">(Sep 04 2020 at 17:13)</a>:</h4>
<p>I'll tackle it. Thanks for the feedback (:</p>



<a name="209118989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209118989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209118989">(Sep 04 2020 at 17:14)</a>:</h4>
<p>No problem. Also feel free to open a PR, even if WIP. It's easier to given comments</p>



<a name="209119129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209119129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209119129">(Sep 04 2020 at 17:16)</a>:</h4>
<p>will do</p>



<a name="209123343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209123343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209123343">(Sep 04 2020 at 17:59)</a>:</h4>
<p>I extended lookup_generic_arg now (<a href="https://github.com/rust-lang/chalk/pull/601/">https://github.com/rust-lang/chalk/pull/601/</a>)<br>
So, whats next on the menu? You talked about impls_for_trait; anything to do there?</p>



<a name="209123759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209123759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209123759">(Sep 04 2020 at 18:02)</a>:</h4>
<p>I think it should work</p>



<a name="209123767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209123767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209123767">(Sep 04 2020 at 18:03)</a>:</h4>
<p>next step is probably tests</p>



<a name="209123789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209123789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209123789">(Sep 04 2020 at 18:03)</a>:</h4>
<p>I don't think you'll need to do anything for <code>impls_for_trait</code></p>



<a name="209123830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209123830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209123830">(Sep 04 2020 at 18:03)</a>:</h4>
<p>Ah great!</p>



<a name="209123967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209123967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209123967">(Sep 04 2020 at 18:05)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22/near/209045135">said</a>:</p>
<blockquote>
<p>For tests: check that they are <code>WellFormed</code>, are not <code>Sized</code>, don't impl <code>Copy</code>, and don't impl <code>Clone</code></p>
</blockquote>
<p>So those things should be tested, where should I add the tests?</p>



<a name="209124139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209124139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209124139">(Sep 04 2020 at 18:06)</a>:</h4>
<p>Add a new <code>extern_types</code> mod under test/test</p>



<a name="209124279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209124279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209124279">(Sep 04 2020 at 18:08)</a>:</h4>
<p><code>string.rs</code> is a pretty good template</p>



<a name="209124636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209124636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209124636">(Sep 04 2020 at 18:11)</a>:</h4>
<p>Oh, it really is!</p>



<a name="209125020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209125020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209125020">(Sep 04 2020 at 18:15)</a>:</h4>
<p>I see, the tests fail - because he is not able to prove that the extern type is not Clone, for example.</p>



<a name="209125153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209125153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209125153">(Sep 04 2020 at 18:16)</a>:</h4>
<p>the tests fail?</p>



<a name="209125193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209125193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209125193">(Sep 04 2020 at 18:17)</a>:</h4>
<p>nvm, gimme a sec</p>



<a name="209125331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209125331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209125331">(Sep 04 2020 at 18:18)</a>:</h4>
<p>I didn't add the traits to the program.</p>



<a name="209126356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209126356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209126356">(Sep 04 2020 at 18:28)</a>:</h4>
<p>It might also be good to add a test impl too, like in the string tests</p>



<a name="209126388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209126388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209126388">(Sep 04 2020 at 18:28)</a>:</h4>
<p>and lowering test</p>



<a name="209126550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209126550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209126550">(Sep 04 2020 at 18:30)</a>:</h4>
<p>you mean using lowering_error! and lowering_success! ?</p>



<a name="209126654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209126654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209126654">(Sep 04 2020 at 18:31)</a>:</h4>
<p>yes</p>



<a name="209126747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209126747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209126747">(Sep 04 2020 at 18:32)</a>:</h4>
<p>probably one to test it parses/lowers</p>



<a name="209126762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209126762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209126762">(Sep 04 2020 at 18:32)</a>:</h4>
<p>Hmm, do we need to check for overlapping defns</p>



<a name="209126782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209126782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209126782">(Sep 04 2020 at 18:32)</a>:</h4>
<p>Try one test with two <code>extern { type A; }</code></p>



<a name="209126977"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209126977" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209126977">(Sep 04 2020 at 18:34)</a>:</h4>
<p>Ah jep, I'll add one. We forbid that extern types shadow each other, right?</p>



<a name="209127046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209127046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209127046">(Sep 04 2020 at 18:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22/near/209126747">said</a>:</p>
<blockquote>
<p>probably one to test it parses/lowers</p>
</blockquote>
<p>Not sure how I can check in particular lowering.</p>



<a name="209127382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209127382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209127382">(Sep 04 2020 at 18:38)</a>:</h4>
<p>It currently accepts multiple extern { type A; }</p>



<a name="209127998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209127998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209127998">(Sep 04 2020 at 18:44)</a>:</h4>
<p>Well, one test with just a single <code>extern { type A; }</code> that should pass with <code>lowering_sucesss</code> and another with two that should pass with <code>lowering_fail</code></p>



<a name="209128015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128015">(Sep 04 2020 at 18:44)</a>:</h4>
<p>Okay, I figured that might happen</p>



<a name="209128030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128030">(Sep 04 2020 at 18:44)</a>:</h4>
<p>Um, let's see what we have to do to fix that</p>



<a name="209128212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128212">(Sep 04 2020 at 18:46)</a>:</h4>
<p>Why not just check before adding to the BTreeMap</p>



<a name="209128373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128373">(Sep 04 2020 at 18:48)</a>:</h4>
<p>That works, now I just need some error to return</p>



<a name="209128385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128385">(Sep 04 2020 at 18:48)</a>:</h4>
<p>I don't think other type kinds are checking for duplicates</p>



<a name="209128408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128408">(Sep 04 2020 at 18:48)</a>:</h4>
<p>Oh, really</p>



<a name="209128462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128462">(Sep 04 2020 at 18:49)</a>:</h4>
<p>Otherwise there'd be similar errors for the other kinds</p>



<a name="209128488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128488">(Sep 04 2020 at 18:49)</a>:</h4>
<p>But it's not really needed for the chalk parser, since it's just used for testing</p>



<a name="209128569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128569">(Sep 04 2020 at 18:50)</a>:</h4>
<p>Yeah, that makes sense</p>



<a name="209128585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128585">(Sep 04 2020 at 18:50)</a>:</h4>
<p>Don't know why I thought we needed this</p>



<a name="209128613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128613">(Sep 04 2020 at 18:50)</a>:</h4>
<p>Ok, so I guess I'll remove that test then.<br>
Do you have any other lowering_error! ideas?</p>



<a name="209128628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128628">(Sep 04 2020 at 18:50)</a>:</h4>
<p>I don't think so</p>



<a name="209128683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128683">(Sep 04 2020 at 18:51)</a>:</h4>
<p>Alright, then I'll commit this</p>



<a name="209128709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128709">(Sep 04 2020 at 18:51)</a>:</h4>
<p>Cool, I'll do a review. But should be quick</p>



<a name="209128719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128719">(Sep 04 2020 at 18:51)</a>:</h4>
<p>And we can get this merged</p>



<a name="209128871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128871">(Sep 04 2020 at 18:52)</a>:</h4>
<p>I guess a question for everyone (but maybe somewhat towards <span class="user-mention" data-user-id="116009">@nikomatsakis</span>) is if we want these to be called <code>Extern</code> or <code>Foreign</code></p>



<a name="209128938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128938">(Sep 04 2020 at 18:53)</a>:</h4>
<p>Its pushed</p>



<a name="209128951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209128951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209128951">(Sep 04 2020 at 18:53)</a>:</h4>
<p>rustc calls them <code>Foreign</code></p>



<a name="209129840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209129840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209129840">(Sep 04 2020 at 19:02)</a>:</h4>
<p><span class="user-mention" data-user-id="335294">@memoryleak47</span> commented</p>



<a name="209130003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209130003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209130003">(Sep 04 2020 at 19:03)</a>:</h4>
<p>Right, lining the naming up with rustc is probably the way to go then, for the <a href="https://github.com/rust-lang/wg-traits/issues/16">shared type library</a> work</p>



<a name="209130501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209130501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209130501">(Sep 04 2020 at 19:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22/near/209129840">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="335294">memoryleak47</span> commented</p>
</blockquote>
<p>Done, running cargo test --all right now</p>



<a name="209130508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209130508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209130508">(Sep 04 2020 at 19:08)</a>:</h4>
<p>Alright, then yeah, let's just go with <code>Foreign</code></p>



<a name="209130531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209130531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209130531">(Sep 04 2020 at 19:08)</a>:</h4>
<p>We'll just follow principle of least surprise here</p>



<a name="209130552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209130552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209130552">(Sep 04 2020 at 19:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22/near/209130003">said</a>:</p>
<blockquote>
<p>Right, lining the naming up with rustc is probably the way to go then, for the <a href="https://github.com/rust-lang/wg-traits/issues/16">shared type library</a> work</p>
</blockquote>
<p>Ok, so <code>ForeignDefId</code>, <code>ForeignDefn</code>, <code>TypeName::Foreign</code> then?</p>



<a name="209130720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209130720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209130720">(Sep 04 2020 at 19:10)</a>:</h4>
<p>Yep!</p>



<a name="209130745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209130745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209130745">(Sep 04 2020 at 19:10)</a>:</h4>
<p>Huh, weird how it's <code>DefId</code> and <code>Defn</code>, but I guess that's consistent with elsewhere</p>



<a name="209130834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209130834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209130834">(Sep 04 2020 at 19:11)</a>:</h4>
<p>Yeah, that's consistent</p>



<a name="209131729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209131729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209131729">(Sep 04 2020 at 19:20)</a>:</h4>
<p>So, took a while to rename everything, but I'm testing now</p>



<a name="209131795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209131795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209131795">(Sep 04 2020 at 19:21)</a>:</h4>
<p>Nice</p>



<a name="209132196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209132196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209132196">(Sep 04 2020 at 19:25)</a>:</h4>
<p>Its pushed now!</p>



<a name="209132251"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209132251" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209132251">(Sep 04 2020 at 19:26)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span></p>



<a name="209132297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209132297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209132297">(Sep 04 2020 at 19:26)</a>:</h4>
<p>I'll take a look</p>



<a name="209132513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209132513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209132513">(Sep 04 2020 at 19:29)</a>:</h4>
<p>LGTM. Once CI is green, I'll r+</p>



<a name="209132828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209132828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209132828">(Sep 04 2020 at 19:32)</a>:</h4>
<p>r+ed thanks <span class="user-mention" data-user-id="335294">@memoryleak47</span></p>



<a name="209132865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209132865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209132865">(Sep 04 2020 at 19:33)</a>:</h4>
<p>Nice, thanks for the support!</p>



<a name="209133407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/209133407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#209133407">(Sep 04 2020 at 19:39)</a>:</h4>
<p>Of course!</p>



<a name="210258812"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20%22Support%20extern%20opaque%20types%22/near/210258812" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20.22Support.20extern.20opaque.20types.22.html#210258812">(Sep 16 2020 at 13:12)</a>:</h4>
<p>Rust-analyzer part: <a href="https://github.com/rust-analyzer/rust-analyzer/pull/5993">https://github.com/rust-analyzer/rust-analyzer/pull/5993</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>